<?php
/**
 * Created by PhpStorm.
 * User: yuyiwen
 * Date: 2018/10/25
 * Time: 下午4:45
 */

namespace app\admin\validate;


use think\Validate;

class Admin extends Validate
{
    protected $rule = [
        'name'  =>  'require',
        'pwd' =>  'require|min:6|checkpwd',
    ];

    protected $message = [
        'name.require' => '用户名不能为空',
        'pwd.require' => '密码不能为空',
        'pwd.min'=> '密码长度不能少于6位',
        'pwd.checkpwd'=> '密码必须纯数字'
    ];

    protected function checkpwd ($value)
    {
        if(is_numeric($value)) {
            return true;
        }else {
            return false;
        }
    }
}